package com.wiretap.service.impl;

import com.wiretap.dao.MessageDao;
import com.wiretap.po.Message;
import com.wiretap.service.MessageService;
import com.wiretap.util.Pager;

public class MessageServiceImpl implements MessageService {
	private MessageDao messageDao;

	@Override
	public Pager<Message> getMessageByOwner(String phone, int currentPage,
			int pageSize) throws Exception {
		return messageDao.queryMessageByOwner(phone, currentPage, pageSize);
	}

	@Override
	public void addMessage(Message message) throws Exception {
		messageDao.addMessage(message);
	}

	public void setMessageDao(MessageDao messageDao) {
		this.messageDao = messageDao;
	}

	@Override
	public boolean deleteMessage(String[] ids) throws Exception {
		return messageDao.deleteMessage(ids) > 0;
	}

	@Override
	public long getMessageCountByPhone(String phone) throws Exception {
		return messageDao.getMessageCountByPhone(phone);
	}

}
